home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13109 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  981 b 

  1. Path: airdmhor.gen.nz!not-for-mail
  2. From: gumboot@airdmhor.gen.nz (Simon Hosie)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: string compressor
  5. Date: 5 Apr 1996 05:29:33 +1200
  6. Organization: Airdmhor : a couple of BBS's, a bunch of people, and a cat.
  7. Distribution: world
  8. Message-ID: <4k10tt$van@airdmhor.gen.nz>
  9. References: <4jpve8$12i@news.cic.net> <Pine.A32.3.91.960401194646.83526C-100000@red.weeg.uiowa.edu>
  10. NNTP-Posting-Host: airdmhor.gen.nz
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. On 2 Apr 1996, Bob Dole wrote:
  14. > If someone would please write me a good string compressor, and let me have 
  15. > the routines as well <yes, a lot to ask> I would be very appreciated.  I 
  16. > also need a decompressor for it, as well.
  17.  
  18. The Amorphous Mass:
  19. >   char *compress(char *str)
  20. >   {
  21. >       if (str) *str = 0;
  22. >       return str;
  23. >   }
  24. >   100% compression every time. :-)
  25.  
  26.  
  27. char *decompress(char *str)
  28. {
  29.     if (str) *str = rand() % CHAR_MAX + 1;
  30.     return str;
  31. }
  32.  
  33.  
  34.   It's a bit lossy, don't you think?
  35.